/* ==========================================================
   App Shell And Navigation
   ========================================================== */

.app{
  min-height:100vh;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.app-logo{
  width:40px;
  height:40px;
  border-radius:13px;
  object-fit:cover;
}

.app-title{
  font-size:18px;
  margin:0;
}

.meta{
  font-size:13px;
  color:var(--muted);
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

body:not(.light) .topbar{
  background:transparent;
  border-bottom:1px solid rgba(214,192,168,.10);
  padding-top:env(safe-area-inset-top, 0px);
}

body.light .topbar{
  background:transparent;
  border-bottom:1px solid rgba(15,23,42,.10);
}

.badge{
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--border-strong);
  color:var(--muted);
  background:rgba(17, 17, 19, 0.22);
}

body.light .badge{
  background:rgba(255,255,255,0.75);
}

.icon-btn{
  background:rgba(17, 17, 19, 0.85);
  border-radius:999px;
  border:1px solid var(--border-strong);
  color:var(--text);
  padding:8px 10px;
  cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.icon-btn:hover{
  border-color:var(--accent);
  transform:translateY(-1px);
  box-shadow:var(--shadow-2);
}

body:not(.light) .icon-btn{
  background:
    linear-gradient(180deg, rgba(255,246,232,.026), rgba(255,246,232,.008)),
    rgba(19,19,21,.92) !important;
  border:1px solid rgba(255,255,255,.08) !important;
  color:rgba(230,237,243,.78) !important;
  border-radius:var(--r-pill) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,247,236,.04),
    inset 0 -1px 0 rgba(0,0,0,.26);
}

body.light .icon-btn{
  background:rgba(15,23,42,.04) !important;
  border:1px solid rgba(15,23,42,.10) !important;
  color:#050608 !important;
  border-radius:var(--r-pill) !important;
}

.tabs-bar{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:8px 0;
  border-bottom:1px solid rgba(148, 163, 184, 0.25);
  scrollbar-width:none;
  -ms-overflow-style:none;
}

.tabs-bar::-webkit-scrollbar{
  display:none;
}

body:not(.light) .tabs-bar{
  background:transparent;
  border-bottom:1px solid rgba(214,192,168,.10);
  padding-bottom:10px;
}

body.light .tabs-bar{
  background:transparent;
  border-bottom:1px solid rgba(15,23,42,.10);
  padding-bottom:10px;
}

.tab-btn{
  border-radius:10px;
  transform:skewX(-8deg);
  border:0;
  padding:7px 13px;
  font-size:13px;
  cursor:pointer;
  background:transparent;
  color:var(--muted);
  white-space:nowrap;
}

body:not(.light) .tab-btn,
body.light .tab-btn{
  background:transparent !important;
  border:0 !important;
  border-radius:10px !important;
  position:relative;
  padding:10px 6px !important;
  letter-spacing:.2px;
}

body:not(.light) .tab-btn{
  color:rgba(231,237,246,.72) !important;
}

body.light .tab-btn{
  color:rgba(15,23,42,.68) !important;
}

body:not(.light) .tab-btn:hover{
  color:rgba(231,237,246,.92) !important;
}

body.light .tab-btn:hover{
  color:rgba(15,23,42,.90) !important;
}

.tab-btn span,
.tab-btn{
  display:inline-flex;
  align-items:center;
}

.tab-btn > *{
  transform:skewX(8deg);
}

.chip-btn{
  border-radius:10px;
  transform:skewX(-8deg);
}

.chip-btn > *{
  transform:skewX(8deg);
}

#btnLedgerFilters,
#btnAddCommodityRow,
#btnRefreshProfit,
#btnExportProfitCsv{
  transform:skewX(-8deg);
  border-radius:10px;
}

#btnLedgerFilters span,
#btnAddCommodityRow span,
#btnRefreshProfit span,
#btnExportProfitCsv span{
  transform:skewX(8deg);
}

.tab-btn.active{
  background:rgba(18, 18, 20, 0.90);
  color:var(--accent);
  border:1px solid rgba(214, 192, 168, 0.32);
}

body:not(.light) .tab-btn.active,
body.light .tab-btn.active{
  color:#0f172a;
}

body:not(.light) .tab-btn.active,
body.light .tab-btn.active{
  color:inherit !important;
}

body.light .tab-btn.active{
  color:#0f172a !important;
}

body:not(.light) .tab-btn.active::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-12px;
  height:2px;
  border-radius:var(--r-pill);
  background:rgba(255,244,230,.58);
  box-shadow:0 0 14px rgba(255,244,230,.08);
}

body.light .tab-btn.active::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-12px;
  height:2px;
  border-radius:var(--r-pill);
  background:rgba(15,23,42,.70);
  box-shadow:none !important;
}

.side-menu{
  position:fixed;
  top:env(safe-area-inset-top, 0px);
  right:0;
  bottom:0;
  width:320px;
  max-width:80%;
  z-index:1400;
  padding:14px;
  padding-top:14px;
  padding-bottom:calc(14px + env(safe-area-inset-bottom, 0px));
  display:flex;
  flex-direction:column;
  gap:10px;
  transform:translate3d(100%, 0, 0);
  transition:transform .22s cubic-bezier(.2,.9,.3,1);
  will-change:transform;
  contain:paint;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  border-top-left-radius:18px;
  border-bottom-left-radius:18px;
  border-left:1px solid rgba(214, 192, 168, 0.10);
  box-shadow:-18px 0 42px rgba(0, 0, 0, 0.48);
  background:var(--glass-surface);
  overflow:hidden;
  scrollbar-width:none;
  -ms-overflow-style:none;
}

.side-menu::-webkit-scrollbar{
  display:none;
}

.side-menu.open{
  transform:translate3d(0, 0, 0);
}

body.light .side-menu{
  background:rgba(255,255,255,0.90);
  box-shadow:-22px 0 60px rgba(15, 23, 42, 0.18);
  border-left:1px solid rgba(15, 23, 42, 0.16);
}

body:not(.light) .side-menu{
  background:
    linear-gradient(180deg, rgba(255,244,230,.026), rgba(255,244,230,.010)),
    rgba(15, 14, 16, 0.975);
  border-left:1px solid rgba(214, 192, 168, 0.14);
  box-shadow:-20px 0 48px rgba(0, 0, 0, 0.56);
}

@media (pointer: coarse), (max-width: 900px){
  body:not(.light) .side-menu{
    -webkit-backdrop-filter:none;
    backdrop-filter:none;
    background:
      linear-gradient(180deg, rgba(255,244,230,.020), rgba(255,244,230,.008)),
      rgba(15, 14, 16, 0.992);
    box-shadow:-16px 0 34px rgba(0, 0, 0, 0.42);
  }
}

.side-menu-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}

.side-menu-sections{
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.menu-item{
  width:100%;
  text-align:left;
  border-radius:var(--radius-md);
  padding:8px 10px;
  border:1px solid var(--border-strong);
  background:rgba(17, 17, 19, 0.94);
  color:var(--text);
  cursor:pointer;
  font-size:14px;
  transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease, color .12s ease;
}

.menu-item:hover{
  border-color:rgba(255, 255, 255, 0.3);
  background:rgba(255, 246, 232, 0.08);
  color:#ffffff;
  transform:translateX(4px);
  box-shadow:0 4px 12px rgba(0, 0, 0, 0.1);
}

body:not(.light) .menu-item{
  background:
    linear-gradient(180deg, rgba(255,244,230,.022), rgba(255,244,230,.008)),
    rgba(17, 17, 19, 0.98);
  border-color:rgba(255,255,255,0.10);
}

body:not(.light) .menu-item:hover{
  border-color:rgba(214, 192, 168, 0.22);
  background:
    linear-gradient(180deg, rgba(255,244,230,.038), rgba(255,244,230,.014)),
    rgba(24, 23, 26, 0.98);
  box-shadow:0 10px 24px rgba(0, 0, 0, 0.24);
}

.menu-item.active{
  background:rgba(255,246,232,0.08);
  border-left:3px solid rgba(255,244,230,0.78);
  padding-left:calc(1rem - 3px);
}

.menu-item.danger:hover{
  border-color:rgba(239, 68, 68, 0.5);
  background:rgba(239, 68, 68, 0.1);
  color:#fca5a5;
}

body.light .menu-item{
  background:rgba(255,255,255,0.90);
  color:#0f172a;
  border-color:rgba(15, 23, 42, 0.16);
}

body.light .menu-item:hover{
  border-color:#0f172a;
  background:#f8fafc;
  color:#0f172a;
  box-shadow:0 10px 25px -5px rgba(15, 23, 42, 0.15);
}

.menu-signout{
  margin-top:auto;
}

.side-menu-divider{
  margin-top:10px;
  padding-top:10px;
  border-top:1px dashed rgba(148, 163, 184, 0.35);
}

body.light .side-menu-divider{
  border-top:1px dashed rgba(15, 23, 42, 0.20);
}

.side-menu-footer{
  margin-top:0;
  padding-top:8px;
  padding-bottom:2px;
  border-top:none;
}

.side-menu-account{
  margin-bottom:8px;
}

.side-menu-legal{
  margin-bottom:4px;
}

.menu-close-icon{
  width:36px;
  height:36px;
  display:block;
}

@media (max-width: 768px){
  .tabs-bar{
    justify-content:space-between !important;
    gap:0 !important;
    padding:10px 0 !important;
    overflow:visible !important;
    flex-wrap:nowrap !important;
  }

  .tab-btn{
    flex:0 0 auto !important;
    width:auto !important;
    margin:0 !important;
    padding:10px 4px !important;
    font-size:13px !important;
    text-align:center !important;
    white-space:nowrap !important;
    letter-spacing:-0.2px !important;
  }
}

#btnOpenMenu{
  color:#94a3b8;
}

body.light #btnOpenMenu{
  color:#050608 !important;
  opacity:1 !important;
}

body.light #btnCloseMenu{
  color:#0f172a !important;
  border-color:rgba(15, 23, 42, 0.2) !important;
  background:rgba(255, 255, 255, 0.5) !important;
}

body:not(.light) .badge,
body:not(.light) #verdictBadge{
  background:
    linear-gradient(180deg, rgba(255,255,255,.040), rgba(255,255,255,.010)),
    rgba(15,20,26,.78) !important;
  border:1px solid rgba(255,255,255,.10) !important;
  color:rgba(230,237,243,.90) !important;
  border-radius:var(--r-pill) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 10px 22px rgba(0,0,0,.18);
}

body.light .badge,
body.light #verdictBadge{
  background:rgba(15,23,42,.06) !important;
  border:1px solid rgba(15,23,42,.14) !important;
  color:rgba(15,23,42,.85) !important;
  border-radius:var(--r-pill) !important;
}
